home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue67 / construc / DrBob42_c.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-01-31  |  24.5 KB  |  756 lines

  1. unit DrBob42_c;
  2.  
  3. {This file was generated on 31 Jan 2001 19:59:58 GMT by version 03.03.03.C1.06}
  4. {of the Inprise VisiBroker idl2pas CORBA IDL compiler.                        }
  5.  
  6. {Please do not edit the contents of this file. You should instead edit and    }
  7. {recompile the original IDL which was located in the file                     }
  8. {D:\usr\bob\magazine\DELPHI.MAG\#67\src\drbob42.idl.                          }
  9.  
  10. {Delphi Pascal unit      : DrBob42_c                                          }
  11. {derived from IDL module : DrBob42                                            }
  12.  
  13.  
  14.  
  15. interface
  16.  
  17. uses
  18.   CORBA,
  19.   DrBob42_i;
  20.  
  21. type
  22.   TRatesHelper = class;
  23.   TRatesStub = class;
  24.   TMoneyHelper = class;
  25.   TAccountTypeHelper = class;
  26.   TNormalAccountHelper = class;
  27.   TNormalAccount = class;
  28.   TSavingAccountHelper = class;
  29.   TSavingAccount = class;
  30.   TNormalOrSavingAccountHelper = class;
  31.   TNormalOrSavingAccount = class;
  32.   TAccountArrayHelper = class;
  33.   TAccountSequenceHelper = class;
  34.   TAccountsHelper = class;
  35.   TAccountsStub = class;
  36.  
  37.   TRatesHelper = class
  38.     class procedure Insert (var _A: CORBA.Any; const _Value : DrBob42_i.Rates);
  39.     class function  Extract(var _A: CORBA.Any) : DrBob42_i.Rates;
  40.     class function  TypeCode     : CORBA.TypeCode;
  41.     class function  RepositoryId : string;
  42.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.Rates;
  43.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.Rates);
  44.     class function  Narrow(const _Obj   : CORBA.CORBAObject; _IsA : Boolean = False) : DrBob42_i.Rates;
  45.     class function  Bind(const _InstanceName : string = ''; _HostName : string = '') : DrBob42_i.Rates; overload;
  46.     class function  Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName: string = '') : DrBob42_i.Rates; overload;
  47.   end;
  48.  
  49.   TRatesStub = class(CORBA.TCORBAObject, DrBob42_i.Rates)
  50.   public
  51.     function  interest_rate : Single; virtual;
  52.     procedure SetRate ( const rate : Single); virtual;
  53.   end;
  54.  
  55.   TMoneyHelper = class
  56.     class procedure Insert (var   _A: CORBA.Any; const _Value : DrBob42_i.Money);
  57.     class function  Extract(const _A: CORBA.Any): DrBob42_i.Money;
  58.     class function  TypeCode    : CORBA.TypeCode;
  59.     class function  RepositoryId: string;
  60.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.Money;
  61.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.Money);
  62.   end;
  63.  
  64.   TAccountTypeHelper = class
  65.     class procedure Insert (var   _A: CORBA.Any; const _Value : DrBob42_i.AccountType);
  66.     class function  Extract(const _A: CORBA.Any): DrBob42_i.AccountType;
  67.     class function  TypeCode    : CORBA.TypeCode;
  68.     class function  RepositoryId: string;
  69.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.AccountType;
  70.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.AccountType);
  71.   end;
  72.  
  73.   TNormalAccountHelper = class
  74.     class procedure Insert (var   _A: CORBA.Any; const _Value : DrBob42_i.NormalAccount);
  75.     class function  Extract(const _A: CORBA.Any): DrBob42_i.NormalAccount;
  76.     class function  TypeCode    : CORBA.TypeCode;
  77.     class function  RepositoryId: string;
  78.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.NormalAccount;
  79.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.NormalAccount);
  80.   end;
  81.  
  82.   TNormalAccount = class (TInterfacedObject, DrBob42_i.NormalAccount)
  83.   private
  84.     balance : DrBob42_i.Money;
  85.     constructor Create; overload;
  86.   public
  87.     function  _get_balance : DrBob42_i.Money; virtual;
  88.     procedure _set_balance ( const _value : DrBob42_i.Money ); virtual;
  89.     constructor Create (const balance : DrBob42_i.Money
  90.                        ); overload;
  91.   end;
  92.  
  93.   TSavingAccountHelper = class
  94.     class procedure Insert (var   _A: CORBA.Any; const _Value : DrBob42_i.SavingAccount);
  95.     class function  Extract(const _A: CORBA.Any): DrBob42_i.SavingAccount;
  96.     class function  TypeCode    : CORBA.TypeCode;
  97.     class function  RepositoryId: string;
  98.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.SavingAccount;
  99.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.SavingAccount);
  100.   end;
  101.  
  102.   TSavingAccount = class (TInterfacedObject, DrBob42_i.SavingAccount)
  103.   private
  104.     balance : DrBob42_i.Money;
  105.     rates : DrBob42_i.Rates;
  106.     constructor Create; overload;
  107.   public
  108.     function  _get_balance : DrBob42_i.Money; virtual;
  109.     procedure _set_balance ( const _value : DrBob42_i.Money ); virtual;
  110.     function  _get_rates : DrBob42_i.Rates; virtual;
  111.     procedure _set_rates ( const _value : DrBob42_i.Rates ); virtual;
  112.     constructor Create (const balance : DrBob42_i.Money;
  113.                             const rates : DrBob42_i.Rates
  114.                        ); overload;
  115.   end;
  116.  
  117.   TNormalOrSavingAccountHelper = class
  118.     class procedure Insert (var   _A: CORBA.Any; const _Value : DrBob42_i.NormalOrSavingAccount);
  119.     class function  Extract(const _A: CORBA.Any): DrBob42_i.NormalOrSavingAccount;
  120.     class function  TypeCode    : CORBA.TypeCode;
  121.     class function  RepositoryId: string;
  122.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.NormalOrSavingAccount;
  123.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.NormalOrSavingAccount);
  124.   end;
  125.  
  126.   TNormalOrSavingAccount = class (TInterfacedObject, DrBob42_i.NormalOrSavingAccount)
  127.   private
  128.     accountN : DrBob42_i.NormalAccount;
  129.     accountS : DrBob42_i.SavingAccount;
  130.     _discriminator : DrBob42_i.AccountType;
  131.   public
  132.     function  _get_accountN : DrBob42_i.NormalAccount; virtual;
  133.     procedure _set_accountN ( const _value : DrBob42_i.NormalAccount ); virtual;
  134.     function  _get_accountS : DrBob42_i.SavingAccount; virtual;
  135.     procedure _set_accountS ( const _value : DrBob42_i.SavingAccount ); virtual;
  136.     function  _get_discriminator : DrBob42_i.AccountType; virtual;
  137.     constructor Create;
  138.   end;
  139.  
  140.   TAccountArrayHelper = class
  141.     class procedure Insert (var   _A: CORBA.Any; const _Value : DrBob42_i.AccountArray);
  142.     class function  Extract(const _A: CORBA.Any): DrBob42_i.AccountArray;
  143.     class function  TypeCode    : CORBA.TypeCode;
  144.     class function  RepositoryId: string;
  145.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.AccountArray;
  146.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.AccountArray);
  147.   end;
  148.  
  149.   TAccountSequenceHelper = class
  150.     class procedure Insert (var   _A: CORBA.Any; const _Value : DrBob42_i.AccountSequence);
  151.     class function  Extract(const _A: CORBA.Any): DrBob42_i.AccountSequence;
  152.     class function  TypeCode    : CORBA.TypeCode;
  153.     class function  RepositoryId: string;
  154.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.AccountSequence;
  155.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.AccountSequence);
  156.   end;
  157.  
  158.   TAccountsHelper = class
  159.     class procedure Insert (var _A: CORBA.Any; const _Value : DrBob42_i.Accounts);
  160.     class function  Extract(var _A: CORBA.Any) : DrBob42_i.Accounts;
  161.     class function  TypeCode     : CORBA.TypeCode;
  162.     class function  RepositoryId : string;
  163.     class function  Read (const _Input  : CORBA.InputStream) : DrBob42_i.Accounts;
  164.     class procedure Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.Accounts);
  165.     class function  Narrow(const _Obj   : CORBA.CORBAObject; _IsA : Boolean = False) : DrBob42_i.Accounts;
  166.     class function  Bind(const _InstanceName : string = ''; _HostName : string = '') : DrBob42_i.Accounts; overload;
  167.     class function  Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName: string = '') : DrBob42_i.Accounts; overload;
  168.   end;
  169.  
  170.   TAccountsStub = class(CORBA.TCORBAObject, DrBob42_i.Accounts)
  171.   public
  172.     procedure AccountArrayTest ( const Accounts : DrBob42_i.AccountArray); virtual;
  173.     procedure AccountSequenceTest ( const Accounts : DrBob42_i.AccountSequence); virtual;
  174.   end;
  175.  
  176.  
  177. implementation
  178.  
  179. class procedure TRatesHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.Rates);
  180. begin
  181.   _A := Orb.MakeObjectRef( TRatesHelper.TypeCode, _Value as CORBA.CORBAObject);
  182. end;
  183.  
  184. class function TRatesHelper.Extract(var _A : CORBA.Any): DrBob42_i.Rates;
  185. var
  186.   _obj : Corba.CorbaObject;
  187. begin
  188.   _obj := Orb.GetObjectRef(_A);
  189.   Result := TRatesHelper.Narrow(_obj, True);
  190. end;
  191.  
  192. class function TRatesHelper.TypeCode : CORBA.TypeCode;
  193. begin
  194.   Result := ORB.CreateInterfaceTC(RepositoryId, 'Rates');
  195. end;
  196.  
  197. class function TRatesHelper.RepositoryId : string;
  198. begin
  199.   Result := 'IDL:DrBob42/Rates:1.0';
  200. end;
  201.  
  202. class function TRatesHelper.Read(const _Input : CORBA.InputStream) : DrBob42_i.Rates;
  203. var
  204.   _Obj : CORBA.CORBAObject;
  205. begin
  206.   _Input.ReadObject(_Obj);
  207.   Result := Narrow(_Obj, True)
  208. end;
  209.  
  210. class procedure TRatesHelper.Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.Rates);
  211. begin
  212.   _Output.WriteObject(_Value as CORBA.CORBAObject);
  213. end;
  214.  
  215. class function TRatesHelper.Narrow(const _Obj : CORBA.CORBAObject; _IsA : Boolean) : DrBob42_i.Rates;
  216. begin
  217.   Result := nil;
  218.   if (_Obj = nil) or (_Obj.QueryInterface(DrBob42_i.Rates, Result) = 0) then
  219.     exit;
  220.   if _IsA and _Obj._IsA(RepositoryId) then
  221.     Result := TRatesStub.Create(_Obj);
  222. end;
  223.  
  224. class function TRatesHelper.Bind(const _InstanceName : string = ''; _HostName: string = '') : DrBob42_i.Rates;
  225. begin
  226.   Result := Narrow(ORB.bind(RepositoryId, _InstanceName, _HostName), True);
  227. end;
  228.  
  229. class function TRatesHelper.Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName : string = '') : DrBob42_i.Rates;
  230. begin
  231.   Result := Narrow(ORB.bind(RepositoryId, _Options, _InstanceName, _HostName), True);
  232. end;
  233.  
  234. function  TRatesStub.interest_rate : Single;
  235. var
  236.   _Output: CORBA.OutputStream;
  237.   _Input : CORBA.InputStream;
  238. begin
  239.   inherited _CreateRequest('interest_rate',True, _Output);
  240.   inherited _Invoke(_Output, _Input);
  241.   _Input.ReadFloat(Result);
  242. end;
  243.  
  244. procedure TRatesStub.SetRate ( const rate : Single);
  245. var
  246.   _Output: CORBA.OutputStream;
  247.   _Input : CORBA.InputStream;
  248. begin
  249.   inherited _CreateRequest('SetRate',True, _Output);
  250.   _Output.WriteFloat(rate);
  251.   inherited _Invoke(_Output, _Input);
  252. end;
  253.  
  254. class procedure TMoneyHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.Money);
  255. begin
  256.   _A := _Value;
  257. end;
  258.  
  259. class function TMoneyHelper.Extract(const _A : CORBA.Any) : DrBob42_i.Money;
  260. var
  261.   _Input : InputStream;
  262.   _Temp  : Single;
  263. begin
  264.   Orb.GetAny(_A, _Input);
  265.   _Input.ReadFloat(_Temp);
  266.   Result := DrBob42_i.Money(_Temp);
  267. end;
  268.  
  269. class function  TMoneyHelper.TypeCode : CORBA.TypeCode;
  270. begin
  271.   Result := ORB.CreateAliasTC(RepositoryId, 'Money', ORB.CreateTC(Integer(0)));
  272. end;
  273.  
  274. class function  TMoneyHelper.RepositoryId : string;
  275. begin
  276.   Result := 'IDL:DrBob42/Money:1.0';
  277. end;
  278.  
  279. class function  TMoneyHelper.Read(const _Input: CORBA.InputStream) : DrBob42_i.Money;
  280. begin
  281.   _Input.ReadFloat(Result);
  282. end;
  283.  
  284. class procedure TMoneyHelper.Write(const _Output : CORBA.OutputStream; const _Value :DrBob42_i.Money);
  285. begin
  286.   _Output.WriteFloat(_Value);
  287. end;
  288.  
  289. class procedure TAccountTypeHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.AccountType);
  290. begin
  291.   _A := _Value;
  292. end;
  293.  
  294. class function TAccountTypeHelper.Extract(const _A : CORBA.Any) : DrBob42_i.AccountType;
  295. begin
  296.   Result := DrBob42_i.AccountType(_A);
  297. end;
  298.  
  299. class function TAccountTypeHelper.TypeCode : CORBA.TypeCode;
  300. begin
  301.   Result := ORB.CreateEnumTC(RepositoryId, 'AccountType', ['normal', 'saving']);
  302. end;
  303.  
  304. class function TAccountTypeHelper.RepositoryId: string;
  305. begin
  306.   Result := 'IDL:DrBob42/AccountType:1.0';
  307. end;
  308.  
  309. class function TAccountTypeHelper.Read(const _Input : CORBA.InputStream) : DrBob42_i.AccountType;
  310. var
  311.   _Temp: Cardinal;
  312. begin
  313.   _Input.ReadULong(_Temp);
  314.   Result := DrBob42_i.AccountType(_Temp);
  315. end;
  316.  
  317. class procedure TAccountTypeHelper.Write(const _Output : CORBA.OutputStream; const _Value  : DrBob42_i.AccountType);
  318. begin
  319.   _Output.WriteULong(Cardinal(_Value));
  320. end;
  321.  
  322. class procedure TNormalAccountHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.NormalAccount);
  323. var
  324.   _Output : CORBA.OutputStream;
  325. begin
  326.   _Output := ORB.CreateOutputStream;
  327.   TNormalAccountHelper.Write(_Output, _Value);
  328.   ORB.PutAny(_A, TNormalAccountHelper.TypeCode, _Output);
  329. end;
  330.  
  331. class function TNormalAccountHelper.Extract(const _A : CORBA.Any) : DrBob42_i.NormalAccount;
  332. var
  333.   _Input : CORBA.InputStream;
  334. begin
  335.   Orb.GetAny(_A, _Input);
  336.   Result := TNormalAccountHelper.Read(_Input);
  337. end;
  338.  
  339. class function TNormalAccountHelper.TypeCode : CORBA.TypeCode;
  340. var
  341.   _Seq: StructMemberSeq;
  342. begin
  343.   SetLength(_Seq, 1);
  344.   _Seq[0].Name := 'balance';
  345.   _Seq[0].TC   := DrBob42_c.TMoneyHelper.TypeCode;
  346.   Result := ORB.MakeStructureTypecode(RepositoryID, 'NormalAccount', _Seq);
  347. end;
  348.  
  349. class function TNormalAccountHelper.RepositoryId : string;
  350. begin
  351.   Result := 'IDL:DrBob42/NormalAccount:1.0';
  352. end;
  353.  
  354. class function TNormalAccountHelper.Read(const _Input : CORBA.InputStream) : DrBob42_i.NormalAccount;
  355. var
  356.   _Value : DrBob42_c.TNormalAccount;
  357. begin
  358.   _Value := DrBob42_c.TNormalAccount.Create;
  359.   _Value.balance := DrBob42_c.TMoneyHelper.Read(_Input);
  360.   Result := _Value;
  361. end;
  362.  
  363. class procedure TNormalAccountHelper.Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.NormalAccount);
  364. begin
  365.   DrBob42_c.TMoneyHelper.Write(_Output, _Value.balance);
  366. end;
  367.  
  368. constructor TNormalAccount.Create;
  369. begin
  370.   inherited Create;
  371. end;
  372.  
  373. constructor TNormalAccount.Create(const balance: DrBob42_i.Money);
  374. begin
  375.   Self.balance := balance;
  376. end;
  377.  
  378. function  TNormalAccount._get_balance: DrBob42_i.Money;
  379. begin
  380.   Result := balance;
  381. end;
  382.  
  383. procedure TNormalAccount._set_balance(const _Value : DrBob42_i.Money);
  384. begin
  385.   balance := _Value;
  386. end;
  387.  
  388. class procedure TSavingAccountHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.SavingAccount);
  389. var
  390.   _Output : CORBA.OutputStream;
  391. begin
  392.   _Output := ORB.CreateOutputStream;
  393.   TSavingAccountHelper.Write(_Output, _Value);
  394.   ORB.PutAny(_A, TSavingAccountHelper.TypeCode, _Output);
  395. end;
  396.  
  397. class function TSavingAccountHelper.Extract(const _A : CORBA.Any) : DrBob42_i.SavingAccount;
  398. var
  399.   _Input : CORBA.InputStream;
  400. begin
  401.   Orb.GetAny(_A, _Input);
  402.   Result := TSavingAccountHelper.Read(_Input);
  403. end;
  404.  
  405. class function TSavingAccountHelper.TypeCode : CORBA.TypeCode;
  406. var
  407.   _Seq: StructMemberSeq;
  408. begin
  409.   SetLength(_Seq, 2);
  410.   _Seq[0].Name := 'balance';
  411.   _Seq[0].TC   := DrBob42_c.TMoneyHelper.TypeCode;
  412.   _Seq[1].Name := 'rates';
  413.   _Seq[1].TC   := DrBob42_c.TRatesHelper.TypeCode;
  414.   Result := ORB.MakeStructureTypecode(RepositoryID, 'SavingAccount', _Seq);
  415. end;
  416.  
  417. class function TSavingAccountHelper.RepositoryId : string;
  418. begin
  419.   Result := 'IDL:DrBob42/SavingAccount:1.0';
  420. end;
  421.  
  422. class function TSavingAccountHelper.Read(const _Input : CORBA.InputStream) : DrBob42_i.SavingAccount;
  423. var
  424.   _Value : DrBob42_c.TSavingAccount;
  425. begin
  426.   _Value := DrBob42_c.TSavingAccount.Create;
  427.   _Value.balance := DrBob42_c.TMoneyHelper.Read(_Input);
  428.   _Value.rates := DrBob42_c.TRatesHelper.Read(_Input);
  429.   Result := _Value;
  430. end;
  431.  
  432. class procedure TSavingAccountHelper.Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.SavingAccount);
  433. begin
  434.   DrBob42_c.TMoneyHelper.Write(_Output, _Value.balance);
  435.   DrBob42_c.TRatesHelper.Write(_Output, _Value.rates);
  436. end;
  437.  
  438. constructor TSavingAccount.Create;
  439. begin
  440.   inherited Create;
  441. end;
  442.  
  443. constructor TSavingAccount.Create(const balance: DrBob42_i.Money;
  444.                                   const rates: DrBob42_i.Rates);
  445. begin
  446.   Self.balance := balance;
  447.   Self.rates := rates;
  448. end;
  449.  
  450. function  TSavingAccount._get_balance: DrBob42_i.Money;
  451. begin
  452.   Result := balance;
  453. end;
  454.  
  455. procedure TSavingAccount._set_balance(const _Value : DrBob42_i.Money);
  456. begin
  457.   balance := _Value;
  458. end;
  459.  
  460. function  TSavingAccount._get_rates: DrBob42_i.Rates;
  461. begin
  462.   Result := rates;
  463. end;
  464.  
  465. procedure TSavingAccount._set_rates(const _Value : DrBob42_i.Rates);
  466. begin
  467.   rates := _Value;
  468. end;
  469.  
  470. class procedure TNormalOrSavingAccountHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.NormalOrSavingAccount);
  471. var
  472.   _Output : CORBA.OutputStream;
  473. begin
  474.   _Output := ORB.CreateOutputStream;
  475.   TNormalOrSavingAccountHelper.Write(_Output, _Value);
  476.   ORB.PutAny(_A, TNormalOrSavingAccountHelper.TypeCode, _Output);
  477. end;
  478.  
  479. class function TNormalOrSavingAccountHelper.Extract(const _A : CORBA.Any) : DrBob42_i.NormalOrSavingAccount;
  480. var
  481.   _Input : CORBA.InputStream;
  482. begin
  483.   Orb.GetAny(_A, _Input);
  484.   Result := TNormalOrSavingAccountHelper.Read(_Input);
  485. end;
  486.  
  487. class function TNormalOrSavingAccountHelper.TypeCode : CORBA.TypeCode;
  488. var
  489.   Seq: UnionMemberSeq;
  490. begin
  491.   SetLength(Seq, 2);
  492.   Seq[0].Member_Name := 'accountN';
  493.   Seq[0].Member_Label:= normal;
  494.   Seq[0].Member_TC   := DrBob42_c.TNormalAccountHelper.TypeCode;
  495.   Seq[1].Member_Name := 'accountS';
  496.   Seq[1].Member_Label:= saving;
  497.   Seq[1].Member_TC   := DrBob42_c.TSavingAccountHelper.TypeCode;
  498.   Result := ORB.CreateUnionTC(RepositoryID, 'NormalOrSavingAccount', DrBob42_c.TAccountTypeHelper.TypeCode, Seq);
  499. end;
  500.  
  501. class function TNormalOrSavingAccountHelper.RepositoryId: string;
  502. begin
  503.   Result := 'IDL:DrBob42/NormalOrSavingAccount:1.0';
  504. end;
  505.  
  506. class function TNormalOrSavingAccountHelper.Read(const _Input: CORBA.InputStream): DrBob42_i.NormalOrSavingAccount;
  507. var
  508.   _Value : DrBob42_c.TNormalOrSavingAccount;
  509.   _Temp  : Integer;
  510. begin
  511.   _Value := TNormalOrSavingAccount.Create;
  512.   _Input.ReadLong(_Temp);
  513.   _Value._discriminator := DrBob42_i.AccountType(_Temp);
  514.   case _Value._discriminator of
  515.     normal : _Value.accountN := DrBob42_c.TNormalAccountHelper.Read(_Input); 
  516.     saving : _Value.accountS := DrBob42_c.TSavingAccountHelper.Read(_Input); 
  517.   end;
  518.   Result := _Value;
  519. end;
  520.  
  521. class procedure TNormalOrSavingAccountHelper.Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.NormalOrSavingAccount);
  522. var
  523.   temp  : Integer;
  524. begin
  525.   temp := Integer(_Value._discriminator);
  526.   _Output.WriteLong(temp);
  527.   case _Value._discriminator of
  528.     normal : DrBob42_c.TNormalAccountHelper.Write(_Output, _Value.accountN);
  529.     saving : DrBob42_c.TSavingAccountHelper.Write(_Output, _Value.accountS);
  530.   end;
  531. end;
  532.  
  533. constructor TNormalOrSavingAccount.Create;
  534. begin
  535.   Self._discriminator := DrBob42_i.AccountType(normal);
  536. end;
  537.  
  538. function  TNormalOrSavingAccount._get_discriminator: DrBob42_i.AccountType;
  539. begin
  540.   Result := _discriminator;
  541. end;
  542.  
  543. function  TNormalOrSavingAccount._get_accountN: DrBob42_i.NormalAccount;
  544. begin
  545.   if ( ( _discriminator <> normal ) 
  546.       )
  547.     then raise BAD_OPERATION.Create(0, COMPLETED_YES);
  548.   Result := accountN;
  549. end;
  550.  
  551. procedure TNormalOrSavingAccount._set_accountN(const _Value : DrBob42_i.NormalAccount);
  552. begin
  553.   _discriminator := normal;
  554.   accountN := _Value;
  555. end;
  556.  
  557. function  TNormalOrSavingAccount._get_accountS: DrBob42_i.SavingAccount;
  558. begin
  559.   if ( ( _discriminator <> saving ) 
  560.       )
  561.     then raise BAD_OPERATION.Create(0, COMPLETED_YES);
  562.   Result := accountS;
  563. end;
  564.  
  565. procedure TNormalOrSavingAccount._set_accountS(const _Value : DrBob42_i.SavingAccount);
  566. begin
  567.   _discriminator := saving;
  568.   accountS := _Value;
  569. end;
  570.  
  571. class procedure TAccountArrayHelper.Insert(var _A: CORBA.Any; const _Value : DrBob42_i.AccountArray);
  572. var
  573.   _Output : CORBA.OutputStream;
  574. begin
  575.   _Output := ORB.CreateOutputStream;
  576.   TAccountArrayHelper.Write(_Output, _Value);
  577.   ORB.PutAny(_A, TAccountArrayHelper.TypeCode, _Output);
  578. end;
  579.  
  580. class function  TAccountArrayHelper.Extract(const _A : CORBA.Any): DrBob42_i.AccountArray;
  581. var
  582.   _Input : CORBA.InputStream;
  583. begin
  584.   Orb.GetAny(_A, _Input);
  585.   Result := TAccountArrayHelper.Read(_Input);
  586. end;
  587.  
  588. class function  TAccountArrayHelper.TypeCode: CORBA.TypeCode;
  589. begin
  590.   Result := ORB.CreateArrayTC(3, DrBob42_c.TNormalOrSavingAccountHelper.TypeCode());
  591. end;
  592.  
  593. class function  TAccountArrayHelper.RepositoryId: string;
  594. begin
  595.   Result := 'IDL:DrBob42/AccountArray:1.0';
  596. end;
  597.  
  598. class function  TAccountArrayHelper.Read(const _Input: CORBA.InputStream) : DrBob42_i.AccountArray;
  599. var
  600.   I0 : Cardinal;
  601. begin
  602.   for I0 := 0 to 2 do
  603.   begin
  604.     Result[I0] := DrBob42_c.TNormalOrSavingAccountHelper.Read(_Input);
  605.   end;
  606. end;
  607.  
  608. class procedure TAccountArrayHelper.Write(const _Output: CORBA.OutputStream; const _Value: DrBob42_i.AccountArray);
  609. var
  610.   I0 : Cardinal;
  611. begin
  612.   for I0 := 0 to 2 do
  613.   begin
  614.     DrBob42_c.TNormalOrSavingAccountHelper.Write(_Output, _Value[I0]);
  615.   end;
  616. end;
  617.  
  618. class procedure TAccountSequenceHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.AccountSequence);
  619. var
  620.   _Output : CORBA.OutputStream;
  621. begin
  622.   _Output := ORB.CreateOutputStream;
  623.   TAccountSequenceHelper.Write(_Output, _Value);
  624.   ORB.PutAny(_A, TAccountSequenceHelper.TypeCode, _Output);
  625. end;
  626.  
  627. class function TAccountSequenceHelper.Extract(const _A : CORBA.Any): DrBob42_i.AccountSequence;
  628. var
  629.   _Input : InputStream;
  630. begin
  631.   Orb.GetAny(_A, _Input);
  632.   Result := TAccountSequenceHelper.Read(_Input);
  633. end;
  634.  
  635. class function  TAccountSequenceHelper.TypeCode: CORBA.TypeCode;
  636. begin
  637.   Result := ORB.CreateSequenceTC(0, DrBob42_c.TNormalOrSavingAccountHelper.TypeCode());
  638. end;
  639.  
  640. class function  TAccountSequenceHelper.RepositoryId: string;
  641. begin
  642.   Result := 'IDL:DrBob42/AccountSequence:1.0';
  643. end;
  644.  
  645. class function  TAccountSequenceHelper.Read(const _Input : CORBA.InputStream) : DrBob42_i.AccountSequence;
  646. var
  647.   L0 : Cardinal;
  648.   I0 : Cardinal;
  649. begin
  650.   _Input.ReadULong(L0);
  651.   SetLength(Result, L0);
  652.   if (L0 > 0) then
  653.   begin
  654.     for I0 := 0 to High(Result) do
  655.     begin
  656.       Result[I0] := DrBob42_c.TNormalOrSavingAccountHelper.Read(_Input);
  657.     end;
  658.   end;
  659. end;
  660.  
  661. class procedure TAccountSequenceHelper.Write(const _Output: CORBA.OutputStream; const _Value: DrBob42_i.AccountSequence);
  662. var
  663.   L0 : Cardinal;
  664.   I0 : Cardinal;
  665. begin
  666.   L0 := Length(_Value);
  667.   _Output.WriteULong(L0);
  668.   if (L0 > 0) then
  669.   begin
  670.     for I0 := 0 to High(_Value) do
  671.     begin
  672.       DrBob42_c.TNormalOrSavingAccountHelper.Write(_Output, _Value[I0]);
  673.     end;
  674.   end;
  675. end;
  676.  
  677. class procedure TAccountsHelper.Insert(var _A : CORBA.Any; const _Value : DrBob42_i.Accounts);
  678. begin
  679.   _A := Orb.MakeObjectRef( TAccountsHelper.TypeCode, _Value as CORBA.CORBAObject);
  680. end;
  681.  
  682. class function TAccountsHelper.Extract(var _A : CORBA.Any): DrBob42_i.Accounts;
  683. var
  684.   _obj : Corba.CorbaObject;
  685. begin
  686.   _obj := Orb.GetObjectRef(_A);
  687.   Result := TAccountsHelper.Narrow(_obj, True);
  688. end;
  689.  
  690. class function TAccountsHelper.TypeCode : CORBA.TypeCode;
  691. begin
  692.   Result := ORB.CreateInterfaceTC(RepositoryId, 'Accounts');
  693. end;
  694.  
  695. class function TAccountsHelper.RepositoryId : string;
  696. begin
  697.   Result := 'IDL:DrBob42/Accounts:1.0';
  698. end;
  699.  
  700. class function TAccountsHelper.Read(const _Input : CORBA.InputStream) : DrBob42_i.Accounts;
  701. var
  702.   _Obj : CORBA.CORBAObject;
  703. begin
  704.   _Input.ReadObject(_Obj);
  705.   Result := Narrow(_Obj, True)
  706. end;
  707.  
  708. class procedure TAccountsHelper.Write(const _Output : CORBA.OutputStream; const _Value : DrBob42_i.Accounts);
  709. begin
  710.   _Output.WriteObject(_Value as CORBA.CORBAObject);
  711. end;
  712.  
  713. class function TAccountsHelper.Narrow(const _Obj : CORBA.CORBAObject; _IsA : Boolean) : DrBob42_i.Accounts;
  714. begin
  715.   Result := nil;
  716.   if (_Obj = nil) or (_Obj.QueryInterface(DrBob42_i.Accounts, Result) = 0) then
  717.     exit;
  718.   if _IsA and _Obj._IsA(RepositoryId) then
  719.     Result := TAccountsStub.Create(_Obj);
  720. end;
  721.  
  722. class function TAccountsHelper.Bind(const _InstanceName : string = ''; _HostName: string = '') : DrBob42_i.Accounts;
  723. begin
  724.   Result := Narrow(ORB.bind(RepositoryId, _InstanceName, _HostName), True);
  725. end;
  726.  
  727. class function TAccountsHelper.Bind(_Options : BindOptions; const _InstanceName : string = ''; _HostName : string = '') : DrBob42_i.Accounts;
  728. begin
  729.   Result := Narrow(ORB.bind(RepositoryId, _Options, _InstanceName, _HostName), True);
  730. end;
  731.  
  732. procedure TAccountsStub.AccountArrayTest ( const Accounts : DrBob42_i.AccountArray);
  733. var
  734.   _Output: CORBA.OutputStream;
  735.   _Input : CORBA.InputStream;
  736. begin
  737.   inherited _CreateRequest('AccountArrayTest',True, _Output);
  738.   DrBob42_c.TAccountArrayHelper.Write(_Output, Accounts);
  739.   inherited _Invoke(_Output, _Input);
  740. end;
  741.  
  742. procedure TAccountsStub.AccountSequenceTest ( const Accounts : DrBob42_i.AccountSequence);
  743. var
  744.   _Output: CORBA.OutputStream;
  745.   _Input : CORBA.InputStream;
  746. begin
  747.   inherited _CreateRequest('AccountSequenceTest',True, _Output);
  748.   DrBob42_c.TAccountSequenceHelper.Write(_Output, Accounts);
  749.   inherited _Invoke(_Output, _Input);
  750. end;
  751.  
  752.  
  753. initialization
  754.  
  755.  
  756. end.